package shiyan4;

import java.util.List;
import java.util.Scanner;

public class test {

	public static void main(String[] args) {
		student student1 = new student(100001, "张三");
		student student2 = new student(100001, "李四");
		classroom computerRoom = new classroom("computerRoom001", "计算机实验室");
		classroom compositionRoom = new classroom("phyicalRoom001", "大学物理实验室");

		count.dePartureRoom(student1, computerRoom);
		count.dePartureRoom(student2, computerRoom);
		count.dePartureRoom(student1, compositionRoom);

		// 计算机网络实验室优秀次数
		int computerExcellentCount = 18;
		int computerPassCount = count.weekCount - computerExcellentCount;
		System.out.println("计算机实验室优秀次数:" + computerExcellentCount);
		System.out.println("计算机实验室合格次数:" + computerPassCount);
		List<?> computerStudentList = count.roomStudentMap.get(computerRoom.getId());
		if (computerStudentList != null) {
			for (int i = 0; i < computerStudentList.size(); i++) {
				student student = (student) computerStudentList.get(i);
				student.setExcellentCount(student.getExcellentCount() + computerExcellentCount);
				student.setPassCount(student.getPassCount() + computerPassCount);
			}
		}

		// 组成原理实验室优秀次数
		int compositionExcellentCount = 18;
		int compositionPassCount = count.weekCount - compositionExcellentCount;
		System.out.println("组成原理实验室优秀次数:" + compositionExcellentCount);
		System.out.println("组成原理实验室合格次数:" + compositionPassCount);

		List<?> compositionStudentList = count.roomStudentMap.get(compositionRoom.getId());
		if (compositionStudentList != null) {
			for (int i = 0; i < compositionStudentList.size(); i++) {
				student student = (student) compositionStudentList.get(i);
				student.setExcellentCount(student.getExcellentCount() + compositionExcellentCount);
				student.setPassCount(student.getPassCount() + compositionPassCount);
			}
		}

		System.out.println("请输入国家最新纳税标准:");
		Scanner scanner = new Scanner(System.in);
		while (true) {
			try {
				count.taxRate = Double.parseDouble(scanner.next());
				break;
			} catch (Exception e) {
				System.err.println("纳税标准输入格式不正确");
				System.out.println("请输入国家最新纳税标准:");
			}
		}
		count.calculateAccout(student1);
		count.calculateAccout(student2);
	}

}
